<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jQuery实现Ajax</title>
    <script src="js/jquery-3.3.1.min.js"></script>
    <script>
        function sendAjax() {
            // $.ajax({
            //     type:'get',
            //     url:'world',
            //     data:{
            //         username:'admin',
            //         password:'123'
            //     },
            //     dataType:'json',
            //     success:function(data){
            //         console.log(data)
            //     },
            //     error:function () {
            //         console.log('Ajax请求失败')
            //     }
            // })

            // $.get('world',{username:'aaa',password:'111'},function(data){
            //     console.log(data)
            // },'json')

            // $.post('world',{username:'aaa',password:'111'},function(data){
            //     console.log(data)
            // },'json')

            $.getJSON('world',{username:'aaa',password:'111'},function(data){
                console.log(data)
            })
        }
    </script>
</head>
<body>
    <button type="button" onclick="sendAjax()">发送Ajax</button>

    <h2 id="content"></h2>

    <script>
        var account = JSON.parse(localStorage.getItem("account"))
        $('#content').html(account.name)
    </script>
</body>
</html>